﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using CodeFirstExample.Data;

namespace CodeFirstExample.Controllers
{
    public class HomeController : Controller
    {
        //
        // GET: /Home/

        public ActionResult Index()
        {
            Data.User user = new Data.User();
            user.Name = "superwalnut";
            user.Email = "superwalnut@test.com";
            user.Gender = 1;
            user.Profile = new Profile()
            {
                FirstName = "kev",
                LastName = "wam"
            };
            user.Addresses = new List<Address>(){
                new Address{
                    Street = "test st",
                    State = "test state"
                }
            };

            CodeFirstExampleContext context = new CodeFirstExampleContext();
            context.Users.Add(user);
            context.SaveChanges();

            return View();
        }

    }
}
